﻿using Commonality.Model;
using Merge.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WZS_Auto_Classifying_Merge
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            System.Diagnostics.Process[] processcollection = System.Diagnostics.Process.GetProcessesByName(Application.ProductName);
            // 如果该程序进程数量大于1，则说明该程序已经运行，则弹出提示信息并退出本次操作，否则就创建该程序  
            if (processcollection.Length > 1)
            {
                MessageBox.Show("应用程序已经在运行中!");
                Log4Net.MsgInfo("应用程序已经在运行中!");
                System.Threading.Thread.Sleep(500);
                Environment.Exit(1);
            }
            else
            {
                Log4Net.MsgDebug(@"****************************************************************************************************************************************************");
                Log4Net.MsgDebug(@"* ------ /|--------------------------------------------------------------------------------------------------------- *");
                Log4Net.MsgDebug(@"*     __/ |__                                                                                                        *");
                Log4Net.MsgDebug(@"*    /       \                                                                                                       *");
                Log4Net.MsgDebug(@"*   /         \         ProjectName " + GObject.ProjectVersion + "                                                                             *");
                Log4Net.MsgDebug(@"*   \         /                                                                                                      *");
                Log4Net.MsgDebug(@"*    \_______/                                                                                                       *");
                Log4Net.MsgDebug(@"* -------------------------------------------------------------------------------------------------------------------*");
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                //UserLogForm userLogForm = new UserLogForm();
                //if (userLogForm.ShowDialog() == DialogResult.OK)
                //{
                //    Application.Run(new MainForm());
                //}
                Application.Run(new MainForm());
                Log4Net.MsgDebug("退出应用程序!");
                Log4Net.MsgDebug("****************************************************************************************************************************************************\r\n\r\n");
            }
        }
    }
}
